#ifndef SDLVIDEOSINK_H
#define SDLVIDEOSINK_H

#include <stdio.h>
#include <stdint.h>
#include <errno.h>
#include <SDL2/SDL.h>
#include "VideoSink.h"
#include "FrameQueue.h"

class SDLVideoSink : public VideoSink
{
public:
	SDLVideoSink();
	virtual ~SDLVideoSink();
	virtual int init(int width, int height, int hor_stride, int ver_stride, AVPixelFormat format);
	virtual bool isInited(){};
	virtual void setDisplayArea(int x, int y, int w, int h);
	virtual int showFrame(Frame *vframe);
	virtual void setProperty(const char *pro, char *val);
	virtual void dumpPicture(const char *file, int start, int count){}
	virtual void keepRatio(bool keepratio){}

	static void eventLoop(void *para);

protected:
	SDL_Window* m_Window;
	SDL_Renderer* m_Renderer;
	SDL_Texture* m_Texture;
	SDL_Rect m_Rect;
	SDL_Event m_Event;

	int m_WindowWidth;
	int m_WindowHeight;
};

#endif